package com.tanjor.common.datatable;

import java.io.Serializable;
import java.util.List;

import com.alibaba.fastjson.JSON;

public class PageReq implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private int draw;
	private int start;
	private int length;
	private String filters;

	private String orderBy;
	
	private Boolean isAsc = true;
	
	public int getDraw() {
		return draw;
	}
	public void setDraw(int draw) {
		this.draw = draw;
	}
	public int getStart() {
		return start;
	}
	public void setStart(int start) {
		this.start = start;
	}
	public int getLength() {
		return length;
	}
	public void setLength(int length) {
		this.length = length;
	}
	
	public List<ColumnFilter> getColumnFilters() {
		return JSON.parseArray(this.filters, ColumnFilter.class);
	}

	public String getOrderBy() {
		return orderBy;
	}
	public void setOrderBy(String orderBy) {
		this.orderBy = orderBy;
	}
	public Boolean getIsAsc() {
		return isAsc;
	}
	public void setIsAsc(Boolean isAsc) {
		this.isAsc = isAsc;
	}
	public String getFilters() {
		return filters;
	}
	public void setFilters(String filters) {
		this.filters = filters;
	}
	public int getPageNumber() {
		if(this.start%this.length!=0){
			return this.start/this.length +1;
		}else{
			return this.start/this.length;
		}
	}

}
